20. Factor returns quiz
Factor returns
Forward returns
For this quiz, note that forward return refers to a return that is in the future, or “forward” in time…compared to when the alpha value was calculated. So, if the alpha values are calculated before time “t”, then the forward asset return is calculated with data that occurs later, from time t to time t plus one. We'll discuss this in a video in a little bit later in this lesson.
Looking at the source code for the alphalens:
factor_returns
The alphalens.performance.factor_returns function looks like this:
weights = factor_weights(factor_data, demeaned, group_adjust, equal_weight)
weighted_returns = factor_data[utils.get_forward_returns_columns(factor_data.columns)] \
.multiply(weights, axis=0)
if by_asset:
returns = weighted_returns
else:
returns = weighted_returns.groupby(level='date').sum()
# preserve freq, which contains trading calendar information
returns.index.freq = factor_data.index.levels[0].freq
return returns
Factor returns